<script setup>
import { useTagStore } from '../../stores/tags';
const props = defineProps({
    item: {
        type: Object,
        required: true
    }
})
const tagsStore = useTagStore()
const addTag = (tag) => {
    tagsStore.addTag(tag)
}
</script>
<template>
    <el-menu-item @click="addTag(item)" :route="{ name: item.name }" :index="item.lable" v-if="!item.children">
        <el-icon :if="item.icon">
            <component :is="item.icon"></component>
        </el-icon>
        <span>{{ item.lable }}</span>
    </el-menu-item>
    <el-sub-menu :index="item.lable" v-else>
        <template #title>
            <el-icon>
                <component :is="item.icon"></component>
            </el-icon>
            <span>{{ item.lable }}</span>
        </template>
        <MenuItem :item="item1" v-for="item1 in item.children" :key="item1.lable">
        </MenuItem>
    </el-sub-menu>
</template>